﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;

namespace ConfExpert.Forms.Espresso
{
    public partial class GecmisAlimlar : XForm
    {
        public GecmisAlimlar()
        {
            InitializeComponent();
        }

        private void Satislar_Load(object sender, EventArgs e)
        {

            gridView1.Init("GetEspAlim2", checkButton1.Checked);
            gridView1.AddDetailGrid(gridView2, "ProductId");

            gridView1.FormatAsNumber(2, "EurFiyat");
            gridView1.FormatAsNumber(0, "SatinAlinanQty", "DepoIdleQty");
            gridView1.AddSummary("SatinAlinanQty", "DepoIdleQty");

            gridView2.FormatAsDate("SipTarihi", "DepoVaris");
            gridView2.FormatAsNumber(2, "FaturaFiyati", "AnlasilanFiyat");
            gridView2.FormatAsNumber(0, "Mt", "DepoyaGelenMt", "LineTotal");
            gridView2.AddSummary("Mt", "DepoyaGelenMt", "LineTotal");

            gridView1.BestFitColumns();
            gridView2.BestFitColumns();

            gridView1.FocusedRowChanged += gridView1_FocusedRowChanged;

            //splitContainerControl1.SizeChanged+=MySizeChanged;
            //checkButton1.CheckedChanged += checkButton1_CheckedChanged;

        }

        void checkButton1_CheckedChanged(object sender, EventArgs e)
        {
            gridView1.RefreshDataSource(true, "GetEspAlim2", checkButton1.Checked);
        }

        void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            txtInfo.Caption = gridView1.GetFocusedRowCellDisplayText("ProductId");
            gridView2.BestFitColumns();
        }
    }
}
